var ctx = "/public";
var prod = "/public";
//replace default server
fis.match('*', {
    release:false,
    deploy:[
        fis.plugin('local-deliver', {
            to: './dist'
        })
    ]
})
//add art subfix for express template
fis.set('project.fileType.text', 'art');

//styles
fis.match('*.scss',{
    preprocessor : fis.plugin("autoprefixer",{
        "browsers": ["last 2 versions"]
    })
})
fis.match('/styles/public.scss', {
    rExt: '.css',
    release:ctx+'$0',
    parser: fis.plugin('node-sass')
})
//scripts
fis.match('/scripts/bundle.js', {
    release:ctx+'$0',
})
//plugins
fis.match('/plugins/**/*.js', {
    release:ctx+'$0',
    optimizer: fis.plugin('uglify-js'),
})
fis.match('/plugins/**/*.css', {
    release:ctx+'$0',
    optimizer: fis.plugin('clean-css')
})
//images
fis.match('/images/**/*.{jpg,png,gif,svg}', {
    release:ctx+'$0',
})
//views
fis.match('/views/**/*.scss', {
    rExt: '.css',
    release:ctx+'$0',
    parser: fis.plugin('node-sass'),
})
fis.match('/views/**/*.js', {
    parser: fis.plugin('translate-es6'),
    release:ctx+'$0',
})
fis.match('/views/**/*.{jpg,png,gif,svg}', {
    release:ctx+'$0',
})
fis.match('/views/(**)/(*).pug', {
    parser: fis.plugin('pug',{
        pretty:true,
        basedir:"./views/layouts",
        ENV:"DEV"
    }),
    rExt: '.art',
    isHtmlLike:true,
    release:'/views/$1',
})
//do not release layouts
fis.match('/views/layouts/**/*.pug', {
    release:'/cache/$0',
})
fis.match('/views/layouts/*.pug', {
    release:'/cache/$0',
})
fis.match('/views/**/_*.pug', {
    release:'/cache/$0',
})


//production
fis.media("pro").match('::package', {
    spriter: fis.plugin('csssprites')
})
fis.media("pro").match('*.scss', {
    useSprite: true
});
fis.media("pro").match('/styles/(*.png)', {
    release:ctx+"/images/$1"
});
fis.media("pro").match('*.{js,scss,png,jpg,gif}', {
    useHash: true
});
fis.media("pro").match('/views/**/*.js', {
    optimizer: fis.plugin('uglify-js'),
})
fis.media("pro").match('*.scss',{
    optimizer: fis.plugin('clean-css')
})
fis.media("pro").match('/views/**/*.pug',{
    parser: fis.plugin('pug',{
        pretty:false,
        basedir:"./views/layouts",
        ENV:"PRO"
    })
})
fis.media("pro").match('/{scripts/bundle.js,styles/public.scss}',{
    url:prod
})
fis.media("pro").match('/views/**/*.{js,scss,jpg,png,gif}',{
    url:prod,
})